import { message } from 'ant-design-vue'

const pageApiData = [
  // {
  //     // Mock.mock('@zip')
  //     url: '/policy/getDownPaymentFile',
  //     type: 'post',
  //     isMock: true,
  //     responseFun: function(Mock) {
  //         return Mock.mock({
  //             "data": '@zip'
  //         })
  //     }
  // },
  {
    url: '/pay/getCounterPaymentData',
    type: 'post',
    isMock: true,
    responseFun: function (Mock) {
      return Mock.mock({
        'data|10': [
          {
            claimno: 'C' + parseInt(Math.random() * 999999999),
            reportcaseno: 'R' + parseInt(Math.random() * 999999999),
            policyno: 'p' + parseInt(Math.random() * 999999999),
            endorseno: 'E' + parseInt(Math.random() * 999999999),
            summaryno: 'H' + parseInt(Math.random() * 999999999),
            datatype: '@cword(5,10)',
            customername: '@cname',
            handledamount: (Math.random() * 50000).toFixed(2),
            taxesamount: (Math.random() * 50000).toFixed(2),
            redtaxesamount: (Math.random() * 50000).toFixed(2),
            redinvoicetaxesamount: (Math.random() * 50000).toFixed(2),
            accountamount: (Math.random() * 50000).toFixed(2),
            amount: (Math.random() * 50000).toFixed(2),
            baseleftamount: (Math.random() * 50000).toFixed(2),
            currencycode: '@cword(5,10)',
            basecurrencycode: '@cword(2)',
            settlementno: 'A' + parseInt(Math.random() * 999999999),
            returnno: Math.random() * 50000,
            businessattr: '@cword(5,10)',
            banks: '@cword(5,10)',
            bankname: '@cword(5,10)',
            description: '@cword(5,10)',
            subcompany: Math.random() * 50000,
            agentcode: '@cword(5,10)',
            opdate: '@date',
            classescode: '@cword(5,10)',
            custaccountno: '@cword(5,10)',
            customercode: Math.random() * 50000,
            fatherno: Math.random() * 50000,
            departmentcode: Math.random() * 50000,
            usedamount: (Math.random() * 50000).toFixed(2),
            handledbaseamount: '@cword(5,10)',
            baseusedamount: (Math.random() * 50000).toFixed(2),
            baseamount: '@cword(5,10)',
            payableno: Math.random() * 50000,
            payableseq: Math.random() * 50000,
            risktype: '@cword(5,10)',
            unitcode: Math.random() * 50000,
            serialno: Math.random() * 50000,
            custseq: Math.random() * 50000,
            paymentmethod: '@cword(5,10)',
            ifpublic: '@cword(5,10)',
            checkcode: '@cword(5,10)',
            checkstatus: '@cword(5,10)',
            checkdate: '@date',
            checkcontent: '@cword(5,10)',
            endorsementrequestno: 'P' + Math.random() * 50000,
            exstatus: '@cword(5,10)',
            exceptioncause: '@cword(5,10)',
            remark: '@cword(5,10)',
            gdunitcode: Math.random() * 50000,
            gdunitname: '@cword(5,10)',

            //  "paymenttime": "@date",
            //  "amount": (Math.random() * 5000).toFixed(2),
            //  "in_currency|+1": drp_currency_values,
            //  "paymentmode|+1": ['1', '2']
          },
        ],
      })
    },
  },
  {
    url: '/pay/getProactivePaymentData',
    type: 'post',
    isMock: true,
    responseFun: function (Mock) {
      return Mock.mock({
        'data|10': [
          {
            claimno: 'C' + parseInt(Math.random() * 999999999),
            reportcaseno: 'R' + parseInt(Math.random() * 999999999),
            policyno: 'p' + parseInt(Math.random() * 999999999),
            endorseno: 'E' + parseInt(Math.random() * 999999999),
            summaryno: 'H' + parseInt(Math.random() * 999999999),
            datatype: '@cword(5,10)',
            customername: '@cname',
            handledamount: (Math.random() * 50000).toFixed(2),
            taxesamount: (Math.random() * 50000).toFixed(2),
            redtaxesamount: (Math.random() * 50000).toFixed(2),
            redinvoicetaxesamount: (Math.random() * 50000).toFixed(2),
            accountamount: (Math.random() * 50000).toFixed(2),
            amount: (Math.random() * 50000).toFixed(2),
            baseleftamount: (Math.random() * 50000).toFixed(2),
            currencycode: '@cword(5,10)',
            basecurrencycode: '@cword(2)',
            settlementno: 'A' + parseInt(Math.random() * 999999999),
            returnno: Math.random() * 50000,
            businessattr: '@cword(5,10)',
            banks: '@cword(5,10)',
            bankname: '@cword(5,10)',
            description: '@cword(5,10)',
            subcompany: Math.random() * 50000,
            agentcode: '@cword(5,10)',
            opdate: '@cdate()',
            classescode: '@cword(5,10)',
            custaccountno: '@cword(5,10)',
            customercode: Math.random() * 50000,
            fatherno: Math.random() * 50000,
            departmentcode: Math.random() * 50000,
            usedamount: (Math.random() * 50000).toFixed(2),
            handledbaseamount: '@cword(5,10)',
            baseusedamount: (Math.random() * 50000).toFixed(2),
            baseamount: '@cword(5,10)',
            payableno: Math.random() * 50000,
            payableseq: Math.random() * 50000,
            risktype: '@cword(5,10)',
            unitcode: Math.random() * 50000,
            serialno: Math.random() * 50000,
            custseq: Math.random() * 50000,
            paymentmethod: '@cword(5,10)',
            ifpublic: '@cword(5,10)',
            checkcode: '@cword(5,10)',
            checkstatus: '@cword(5,10)',
            checkdate: '@cdate()',
            checkcontent: '@cword(5,10)',
            endorsementrequestno: 'P' + Math.random() * 50000,
            exstatus: '@cword(5,10)',
            exceptioncause: '@cword(5,10)',
            remark: '@cword(5,10)',
            gdunitcode: Math.random() * 50000,
            gdunitname: '@cword(5,10)',

            //  "paymenttime": "@date",
            //  "amount": (Math.random() * 5000).toFixed(2),
            //  "in_currency|+1": drp_currency_values,
            //  "paymentmode|+1": ['1', '2']
          },
        ],
      })
    },
  },
  {
    url: '/pay/imageAudit',
    type: 'post',
    isMock: true,
    responseFun: function (Mock) {
      return true
    },
  },
  {
    url: '/pay/submitData',
    type: 'post',
    isMock: true,
    responseFun: function (Mock) {
      return true
    },
  },
]

function mockConfig(Mock) {
  pageApiData.forEach((item) => {
    item.isMock &&
      Mock.mock(item.url, item.type, () => {
        if (!(item.url.includes('imageAudit') || item.url.includes('submitData'))) {
          message.warning('！！注意此为mock获取的数据！')
        }
        return item.responseFun(Mock)
      })
  })
}

export default mockConfig
